require('dotenv').config()
const mysql = require('mysql2/promise');

const pool = mysql.createPool({
    host: process.env.DB_HOST,
    user: process.env.DB_USER,
    password: process.env.DB_PASSWORD,
    database: 'dynamiachattest',
    multipleStatements: true,
    charset: 'utf8mb4',
    waitForConnections: true,
    connectionLimit: 10,
});


pool.getConnection()
    .then((connection) => {
        console.log('Connected to MySQL');
        connection.release();
    })
    .catch((err) => {
        console.error('MySQL Connection Error:', err);
    });

module.exports = pool;